<?php

// reference the file containing the connect class
require_once(HOME_PATH.'homeLib.class.php');

// retrieve the operation to be performed
$mode = $_POST['mode'];

// create a new connectDB instance
$connenct = new Connenct();

// Clear the output
if (ob_get_length ())
    ob_clean();
// Headers are sent to prevent browsers from caching
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . 'GMT');
header('Cache-Control: no-cache, must-revalidate');
header('Pragma: no-cache');
header('Content-Type: application/json');
// retrieve new messages from the server

if ($mode == 'RetrieveNew') {
    echo json_encode($connenct->retrieveNewNews());
}

if ($mode == 'RetrieveAllNew') {
    echo json_encode($connenct->retrieveAllNews());
}
?>
